package com.isloop.jasson;

import com.jasson.im.api.APIClient;

public class SendMessage {
	private String dbip;
	private String dbUser;
	private String dbPwd;
	private String apiCode;
	private String dbName;
	
	public SendMessage(String dbip,String dbUser,String dbPwd,String apiCode,String dbName){
		this.dbip=dbip;
		this.dbUser=dbUser;
		this.dbPwd=dbPwd;
		this.apiCode=apiCode;
		this.dbName=dbName;
	}
	
	public boolean sendMsg(String mobile,String context){
		boolean flag = false;
		long smId = 0;
		int API_Result = 0;
		int API_Send = 0;
		APIClient api = new APIClient();
		API_Result=api.init(dbip, dbUser,dbPwd,apiCode,dbName);
		System.err.println(API_Result);
		if(API_Result==api.IMAPI_SUCC){
			for (int i = 0; i < 3; i++) {
				API_Send=api.sendSM(mobile,context, smId);
				if (API_Send == APIClient.IMAPI_SUCC) {
					flag = true;
					break;
				}
			}
			api.release();
		}
		return flag;
	}
	public static void main(String[] args) {
		
	}
}
